<?php

namespace App\Service\UserCenter;

use App\Constants\ErrorCode;
use App\Model\UserProfilePersonal;
use App\Service\BaseService;

/**
 * 提现检测
 */
class WithdrawCheckService extends BaseService
{
    public function handle()
    {
        $userId = $this->getUserId();
        $personInfo = UserProfilePersonal::getProfile($userId);
        if (!$personInfo) {
            return $this->setError(ErrorCode::WITHDRAW_INFO_EMPTY, '提现资料还未提交~');
        }
        if ($personInfo['flag'] == UserProfilePersonal::STATUS_ING) {
            return $this->setError(ErrorCode::WITHDRAW_INFO_ING, '提现资料审核中，请耐心等待~');
        } elseif ($personInfo['flag'] != UserProfilePersonal::STATUS_OK) {
            return $this->setError(ErrorCode::WITHDRAW_INFO_ING, '提现资料审核不通过, 请重新提交资料~');
        }
        return [
            'check_result' => 1
        ];
    }
}
